/*for(let i=0;i<5;i++)
{
	console.log('i:'+i)
}
console.log('块级外:'+i)*/

//---------------------------------------

/*const LOVE = true;
//LOVE = 1;
console.log('LOVE:'+LOVE);*/

//------------------------------------------

let user={name:'zhangsan',age:'18'};
const A =user;
console.log('userName:'+A.name);  //结果为zhangsan
user.name='lisi';
console.log('userName:'+A.name);  //结果为lisi

//实例测试
//es5
var arr = [];
for (var i = 0; i < 10; i++) {
	console.log(i); //0-9
    arr.push(function(){console.log(i)}) //这里的i值传不进去的，到push到arr中还是i
}
console.log(i);
console.log(arr[0]());  //undefined
arr.forEach(function(a) {
   a(); //i既然等于10了，打印出的肯定是10个10
})

//es6
const brr = [];
for (let m = 0; m < 10; m++) {
	console.log(m);//0-9
    brr.push(function() {
        console.log(m) //这里的m没有值
    })
}
console.log(brr[0]());//undefined
//console.log(m); //这里的m没有值，会报错
brr.forEach(fn => fn());//输出0-9
